# -----------------------------------------------------------------------------
# Sources
# -----------------------------------------------------------------------------

set(FRONTEND_SOURCES
    base.c
    context.c
    scanner.c
    parser.c
    nodes.c
    structures.c
    map.c
    array.c
    symbol.c
)

set(COMPILER_SOURCES
    main.c
)

include_directories(${PROJECT_SOURCE_DIR}/src)

add_library(${LANG_LIB} SHARED ${FRONTEND_SOURCES})
add_library(${LANG_LIB}_static STATIC ${FRONTEND_SOURCES})
add_executable(${LANG_CC} ${FRONTEND_SOURCES} ${COMPILER_SOURCES})

target_link_libraries(${LANG_LIB} ${EXTERNAL_LIBS})
target_link_libraries(${LANG_LIB}_static ${EXTERNAL_LIBS})
target_link_libraries(${LANG_CC} ${EXTERNAL_LIBS} gmp)

# -----------------------------------------------------------------------------
# Installing
# -----------------------------------------------------------------------------

install(TARGETS ${LANG_LIB} LIBRARY DESTINATION lib)

install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/ DESTINATION include/${PROJECT_NAME}
    FILES_MATCHING PATTERN "*.h")

